#include <iostream>
#include <stdio.h>
#include <unistd.h>
using namespace std;


int main()
{
  int ret = fork();
  int myval = 100;
  if (ret == 0)
  {
    // child 
    int count = 5;
    while(count--)
    {
      printf("child id: %d,child val: %d ,child address: %p\n",getpid(),myval,&myval);
      sleep(1);
      if (count == 3)
      {
        myval = 20;
      }
    }
  }
  else
  {
    while (1)
    {
       printf("father id: %d,father val: %d ,father address: %p\n",getpid(),myval,&myval);
       sleep(1);

    }
  }
  return 0;
}
